package edu.sctu.practice.class01.xiangkun.assign02.Calculator;

/**
 * Created by xiangkun on 2015/10/8.
 */
public class Rational {
    private double numberone;
    private double numbertwo;
    private double resofsum;
    private double resofsub;
    private double resofmulti;
    private double resofdiv;

    public Rational(double numberone,double numbertwo ){
        this.numberone = numberone;
        this.numbertwo = numbertwo;
    }

    public double plus(){
        resofsum = numberone + numbertwo;
        return resofsum;
    }

    public double sub(){
        resofsub = numberone - numbertwo;
        return resofsub;
    }

    public double multi(){
        double resofmulti = numberone * numbertwo;
        return resofmulti;
    }

    public double div(){
        if(numbertwo != 0){
            resofdiv = numberone / numbertwo;
        } else{
            System.out.println("分母不能為0！");
        }
        return resofdiv;
    }
}
